package buffered;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class BufferedCharTest {
	public static void main(String[] args) throws IOException {
		FileWriter fw = new FileWriter("a.txt",true);	//write(char[]) write(char)
		BufferedWriter bw = new BufferedWriter(fw);	//->write(String)
		
		bw.write("hello world");
		bw.flush();
		
		bw.close();
		fw.close();
		
		FileReader fr = new FileReader("a.txt");
		BufferedReader br = new BufferedReader(fr);	// readLine()
		String str;
		while((str = br.readLine()) != null){
			System.out.println(str);
		}
		br.close();
		fr.close();
		
		
	}
}
